<?php
/**
 * Created by PhpStorm.
 * User: mf
 * Date: 2017/9/12
 * Time: 16:25
 */
namespace app\admin\controller;

use think\Request;
use app\admin\logic\Order as LogicOrder;
use tool\Common;

class Order extends Base
{
    protected $order;

    public function __construct(LogicOrder $order)
    {
        parent::__construct();
        $this->order = $order;
    }

    //生成预订单
    public function createPreOrder()
    {
        $data = [
            'cartID' => 14,
            'sellerID' => 1,
            'productID' => 1,
            'number' => 10,
            'price' => 2000.00,
            'totalPrice' => 20000.00
        ];
        //$data = Request::instance()->post();
        //$order = new LogicOrder();
        $res = $this->order->init($data)->createPreOrder();
        Common::json($res);
    }

    //得到预订单列表
    public function getPreorderList()
    {
        $res = $this->order->getPreorderList();
        Common::json($res);
    }

    //修改预订单
    public function updatePreOrder()
    {
        $data = [
            'preOrderID' => 13
        ];
        //$data = Request::instance()->post();
        $res = $this->order->init($data)->updatePreOrder();
        Common::json($res);
    }
}